package com.zmn.plat.dubbo.impl.plat.biztype;

import java.util.List;
import java.util.Objects;

import javax.annotation.Resource;

import com.zmn.plat.common.dictionary.PlatErrorCodeDict;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;

import com.zmn.common.dto2.ResponseDTO;
import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
import com.zmn.plat.dubbo.interfaces.plat.biztype.PlatBizTypeListRemoteService;
import com.zmn.plat.dubbo.utils.DubboConsts;
import com.zmn.plat.services.interfaces.plat.biztype.PlatBizTypeService;

/**
 * 描述：平台开通业务类型dubbo接口实现类
 * 
 * @author linfeng
 * @version v1.0
 * @since 2020/09/07
 */
@Slf4j
@Service(version = DubboConsts.INTERFACE_VERSION, validation = "true")
public class PlatBizTypeListRemoteServiceImpl implements PlatBizTypeListRemoteService {

    @Resource
    PlatBizTypeService platBizTypeService;

    @Override
    @ReadOnlyConnection
    public ResponseDTO<List<Integer>> listBizTypeByPlat(Integer plat) {
        log.info("listBizTypeByPlat 参数为：{}", plat);
        if (Objects.isNull(plat)) {
            log.error("listBizTypeByPlat is null,参数为：{}", plat);
            return ResponseDTO.fromErrorCodeTable(PlatErrorCodeDict.ERROR_CODE_PANAM_NULL);
        }

        List<Integer> bizTypes = platBizTypeService.listBizTypeByPlat(plat);

        return ResponseDTO.success(bizTypes);
    }
}
